package me.yuxiaoyao.lock;

import me.yuxiaoyao.lock.exception.DistributedLockException;

import java.util.concurrent.locks.Lock;


/**
 * @author kerryzhang on 2020/12/21
 */


public interface LockExecutor {

    /**
     * lock
     *
     * @param lockKey
     * @return
     * @throws DistributedLockException
     */
    Lock getLock(Object lockKey);

    /**
     * 支持重入
     *
     * @return
     */
    default boolean isSupportReentrant() {
        return false;
    }

    /**
     * 支持公平锁
     *
     * @return
     */
    default boolean isSupportFair() {
        return false;
    }

    /**
     * 支持阻塞锁
     *
     * @return
     */
    default boolean isSupportBlock() {
        return false;
    }

}
